package com.mind.ridge.controller;

import com.mind.ridge.pojo.front.User;
import com.mind.ridge.service.front.UserService;
import com.mind.ridge.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author Mind
 */
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {
    @Resource
    private UserService userService;

    @PostMapping("/login")
    public R<String> login(@RequestBody Map<String,String> info, HttpServletRequest request) {
        return userService.login(info, request);
    }

    @PostMapping("/sendMsg")
    public R<User> sendMsg(@RequestBody User user,HttpServletRequest request){
        return userService.sendMsg(user,request);
    }
}
